package com.yida.system.api;

import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import com.yida.common.core.constant.SecurityConstants;
import com.yida.common.core.constant.ServiceNameConstants;
import com.yida.common.core.domain.R;
import com.yida.system.api.domain.SysSms;
import com.yida.system.api.domain.SysUser;
import com.yida.system.api.factory.RemoteSmsFallbackFactory;

/**
 * 短信服务
 * 
 * @author hmh
 * @date 2022/10/26
 */
@FeignClient(contextId = "remoteSmsService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface RemoteSmsService {

    @PostMapping("/sms/sendSmsCode")
    public R<SysSms> sendMsgCode(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 20230321 hmh
     * 
     * @param phonenumber
     * @param source
     * @return
     */
    @PostMapping("/sms/sendSmsByPhonenumber")
    public R<SysSms> sendSmsByPhonenumber(@RequestBody SysSms sysSms, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 20230404 hmh
     * 
     * @param phonenumber
     * @param source
     * @return
     */
    @PostMapping("/sms/sendAuthSmsByPhonenumber")
    public R<SysSms> sendAuthSmsByPhonenumber(@RequestBody SysSms sysSms, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/sms/removeSmsCode/{phonenumber}")
    public R<Boolean> removeSmsCode(@PathVariable("phonenumber") String phonenumber, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 根据手机号和源删除信息
     * 
     * @param phonenumber
     * @param smsSource
     * @param source
     * @return
     */
    @GetMapping("/sms/removeSms")
    public R<Boolean> removeSms(@RequestParam("phonenumber") String phonenumber, @RequestParam("smsType") Integer smsType, @RequestParam("smsSource") String smsSource, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
